﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using RBS.Core.Model;

namespace RBS.Core.BLL
{
    public  class SpBll
    {
       private readonly RBS.Core.DAL.SpDal dal = new RBS.Core.DAL.SpDal();
       /// <summary>
       /// 当日数据
       /// </summary>
       /// <param name="hotelid">酒店ID</param>
       /// <param name="time">查询时间</param>
       /// <returns></returns>
       public  ThatDay  GetThatDay(int hotelid, DateTime time)
       {
           return dal.GetThatDay(hotelid, time);
       } 
       public List<ThatDay> GetThatMonth(int hotelid, DateTime time)
       {
           return dal.GetThatMonth(hotelid, time);
       }

       /// <summary>
       /// 获取剩余餐桌数
       /// </summary>
       /// <param name="id"></param>
       /// <param name="time"></param>
       /// <returns></returns>
       public ApiHotelSeat GetApiHotelSeat(int id, DateTime time)
       {
           return dal.GetApiHotelSeat(id, time);
       }


        #region 食客统计 
        public IList GetUserChart(int hid)
        {
           var ds=  dal.GetUserChart(hid); 
            return   RBS.Common.IListDataSet.DataTableToIList(ds.Tables[0]);
        } 
        #endregion

        #region 酒店统计

        /// <summary>
        /// 热门酒店统计
        /// </summary>
        /// <param name="beginDate"></param>
        /// <param name="endDate"></param>
        /// <returns></returns>
        public IList GetHotHotelChart(DateTime beginDate, DateTime endDate)
        {
            var ds = dal.GetHotHotelChart(beginDate, endDate);
            return RBS.Common.IListDataSet.DataTableToIList(ds.Tables[0]); 
        }

        /// <summary>
        /// 酒店评价消费统计
        /// </summary>
        /// <param name="beginDate"></param>
        /// <param name="endDate"></param>
        /// <returns></returns>
        public IList GetHotelConsumptionChart()
        {
            var ds = dal.GetHotelConsumptionChart();
            return RBS.Common.IListDataSet.DataTableToIList(ds.Tables[0]); 
        }

        /// <summary>
        /// 获取热门菜谱
        /// </summary>
        /// <param name="hid"></param>
        /// <param name="isadmin"></param>
        /// <param name="beginDate"></param>
        /// <param name="endDate"></param>
        /// <returns></returns>
        public IList GetHotelHotCookBookAdmin(DateTime beginDate, DateTime endDate)
        {
            var ds = dal.GetHotelHotCookBook(0, true, beginDate, endDate);
            return RBS.Common.IListDataSet.DataTableToIList(ds.Tables[0]); 
        }

        #endregion
    }
}
